Skip to content

Conversation

@jennifer-shehane
Copy link
Member

@jennifer-shehane jennifer-shehane commented Nov 21, 2025

Additional details

In open mode, the Protocol Manager was intercepting and processing all response streams even when the Studio panel was not open.

Steps to test

How has the user experience changed?

PR Tasks


Note

Protocol interception now runs only when Studio is active; adds Studio AI access state and exposes mode, and always ends empty-body responses promptly.

  • Proxy/Response handling (packages/proxy/lib/http/response-middleware.ts):
    • Gate protocol notifications (responseEndedWithEmptyBody, responseStreamReceived) on protocolManager.isProtocolEnabled and Studio active state (mode === 'studio' with dbPath).
    • Add debug traces for protocol notifications; still invoke safely when disabled to avoid disrupting streams.
    • Always end empty-body responses (204/304/HEAD) immediately.
  • Cloud Protocol Manager (packages/server/lib/cloud/protocol.ts):
    • Expose mode getter and add canAccessStudioAI state with setter; reset on close().
  • Project setup (packages/server/lib/project-base.ts):
    • Set protocolManager.setCanAccessStudioAI(...) during Studio initialization.
  • Types (packages/types/src/protocol.ts):
    • Extend ProtocolManagerShape with optional mode, canAccessStudioAI, and setCanAccessStudioAI().

Written by Cursor Bugbot for commit 303e990. This will update automatically on new commits. Configure here.

@jennifer-shehane jennifer-shehane self-assigned this Nov 21, 2025
@cypress
Copy link

cypress bot commented Nov 22, 2025

cypress    Run #67531

Run Properties:  status check passed Passed #67531  •  git commit 303e99001f: don't use protocol in response-middleware if not in Studio + AI
Project cypress
Branch Review prevent-intercept-studio-protocol
Run status status check passed Passed #67531
Run duration 20m 20s
Commit git commit 303e99001f: don't use protocol in response-middleware if not in Studio + AI
Committer Jennifer Shehane
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 14
Tests that did not run due to a developer annotating a test with .skip  Pending 1097
Tests that did not run due to a failure in a mocha hook  Skipped 4
Tests that passed  Passing 26698
View all changes introduced in this branch ↗︎

Warning

Partial Report: The results for the Application Quality reports may be incomplete.

UI Coverage  45.61%
  Untested elements 187  
  Tested elements 161  
Accessibility  98.01%
  Failed rules  4 critical   8 serious   2 moderate   2 minor
  Failed elements 101  

proxyRequestCorrelationDuration: preRequest.proxyRequestCorrelationDuration,
},
})
// resultingStream will be undefined, so we continue with original stream
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Protocol manager still processes streams when Studio inactive

When shouldProcess is false (Studio mode without active Studio), the code still calls protocolManager.responseStreamReceived, which processes and intercepts the response stream. The comment claims invokeSync returns undefined safely, but invokeSync only returns early if _protocol is undefined. Since isProtocolEnabled is true here, _protocol exists, so the stream gets processed anyway, defeating the PR's goal of preventing interception when Studio isn't open.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants